<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

function dt_type($type,$confs)
{	
	if($type==1)//1:输入框
	{
		$str='<input type="text" class="form-control" ">';
		echo $str;
	}
	elseif($type==2)//2:单选
	{	
			$valuesArr=explode(',', $confs['values']);
			$valueAttr=$confs['value'];
			foreach ($valuesArr as $k1 => $v1) 		
			{

				if($valueAttr==$v1)
				{
					$str=' <div class="radio radio-info radio-inline">
			        <input type="radio" id="inlineRadio'.$k1.'" value="'.$v1.'" name="radioInline" checked="" >
			        <label for="inlineRadio'.$k1.'">'.$v1.'</label>
			   		</div>';
				}
				else
				{
					$str=' <div class="radio radio-info radio-inline">
			        <input type="radio" id="inlineRadio'.$k1.'" value="'.$v1.'" name="radioInline" >
			        <label for="inlineRadio'.$k1.'">'.$v1.'</label>
			   		</div>';					
				}
		   		echo $str;
			}
	}	
	elseif($type==3)//3:复选,
	{
		$valuesArr=explode(',', $confs['values']);
		$valueArr=explode(',',$confs['value']);
		foreach ($valuesArr as $k2 => $v2) 
		{

				if(in_array($v2, $valueArr))
				{
					$str='<div class="checkbox checkbox-success checkbox-inline">
		                <input type="checkbox" id="inlineCheckbox'.$k2.'" value="$v2'.$k2.'" checked="checked">
		                <label for="inlineCheckbox'.$k2.'">'.$v2.'</label>
		         	  </div>'; 	

				}
				else
				{
					$str='<div class="checkbox checkbox-success checkbox-inline">
			                <input type="checkbox" id="inlineCheckbox'.$k2.'" value="$v2'.$k2.'" >
			                <label for="inlineCheckbox'.$k2.'">'.$v2.'</label>
			         	  </div>'; 				
				}

 				echo $str;
      
		}

          
	}	
	elseif($type==4)//4:下接菜单
	{
		$valuesArr=explode(',', $confs['values']);
		$valueArr=$confs['value'];
		foreach ($valuesArr as $k4 => $v4) 
		{
			if($valueArr==$v4)
			{
	
				$str='<option value="'.$v4.'" selected="selected">'.$v4.'</option>';
	            			
			}
			else
			{
				$str='<option value="'.$v4.'">'.$v4.'</option>';

			}
 			 echo $str;  
		}


	}	
	elseif($type==5)//5:文本域,
	{
		$str='<textarea class="form-control" id="message" rows="3" placeholder="" name="values"></textarea>';
		echo $str;
	}	
	elseif($type==6)//6:附件
	{
		$str='<input type="file">';
		echo $str;
	}
	
}



